package disPatcher;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author： pang-yun
 * @date： 2021-11-26 17:42
 * 功能目的 ：用于 转发请求
 */

public class First extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println(req.getParameter("name"));


        req.setAttribute("second","2");
        RequestDispatcher requestDispatcher = req.getRequestDispatcher("/second");
        requestDispatcher.forward(req,resp);
    }
}
